package logic

import (
	"context"
	"manage/managerpc/managerpc"

	"manage/api/internal/svc"
	"manage/api/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type LeaveListLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewLeaveListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *LeaveListLogic {
	return &LeaveListLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *LeaveListLogic) LeaveList(req *types.LeaveListRequest) (resp *types.Response, err error) {
	// todo: add your logic here and delete this line
	login, err := l.svcCtx.Managerpc.LeaveList(l.ctx, &managerpc.LeaveListRequest{})
	if err != nil {
		return &types.Response{
			Message: err.Error(),
			Data:    nil,
			Code:    500,
		}, nil
	}
	return &types.Response{
		Message: "留言列表成功",
		Data:    login,
		Code:    200,
	}, nil
}
